package com.ibeeking.gmc.global.api.feign;

import com.ibeeking.gmc.global.api.feign.fallback.GlobalOpenFeignFallbackFactory;
import com.ibeeking.found.common.entity.open.*;
import com.ibeeking.gmc.global.api.common.dto.OauthClientDTO;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Author ibeeking
 */
@FeignClient(name = "gmc-global-g-server", contextId = "globalOpenFeignClient", path = "/g", fallbackFactory = GlobalOpenFeignFallbackFactory.class, decode404 = true)
public interface GlobalOpenFeignClient {

    // 查询第三方平台公众号配置信息

    /**
     * 查询有效的微信第三方平台配置信息
     * @param query
     * @return
     */
    @PostMapping(value = "/open/feign/v1/queryOpenConfigList")
    ResponseResult<List<OpenConfigDTO>> queryOpenConfigList(@RequestBody OpenConfigQuery query);
    /**
     * 查询第三方平台公众号配置信息
     * @param query
     * @return
     */
    @PostMapping(value = "/open/feign/v1/queryOpenConfigOne")
    ResponseResult<OpenConfigDTO> queryOpenConfigOne(@RequestBody OpenConfigQuery query);

    // 查询第三方平台开放平台授权信息

    /**
     * 取得所有租户的开放平台授权权限列表
     * @return
     */
    @PostMapping(value = "/openAuth/feign/v1/queryOpenAuthList")
    ResponseResult<List<OpenAuthDTO>> queryOpenAuthList(@RequestBody OpenAuthQuery query);

    /**
     * 取得租户的开放平台授权列表
     * @param query
     * @return
     */
    @PostMapping(value = "/openAuth/feign/v1/querySimpleOpenAuthList")
    ResponseResult<List<SimpleOpenAuthDTO>> querySimpleOpenAuthList(@RequestBody OpenAuthQuery query);
    /**
     * 取得租户的开放平台授权列表
     * @param query
     * @return
     */
    @PostMapping(value = "/openAuth/feign/v1/queryOpenAuthOne")
    ResponseResult<OpenAuthDTO> queryOpenAuthOne(@RequestBody OpenAuthQuery query);

    /**
     * 取得租户的开放平台授权列表
     * @param query
     * @return
     */
    @PostMapping(value = "/openAuth/feign/v1/querySimpleOpenAuthOne")
    ResponseResult<SimpleOpenAuthDTO> querySimpleOpenAuthOne(@RequestBody OpenAuthQuery query);

       // 其他信息

    /**
     *
     * @param clientId
     * @return
     */
    @PostMapping(value = "/oauth2/client/feign/v1/queryByClientId/{clientId}")
    ResponseResult<OauthClientDTO> queryByClientId(@PathVariable("clientId") String clientId);
}
